<template>
  <div>
    <input @keyup.enter="submit" placeholder="输入回车录入" type="text" v-model="title">
  </div>
</template>

<script>
  export default {
    name: "Search",
    data() {
      return {
        title: ""
      }
    },
    methods: {
      submit() {
        const task = {
          check: false,
          title: this.title
        };
        // 触发自定义的add事件
        this.$emit("add", task);
        this.title = "";
      }
    }
  }
</script>

<style scoped>

</style>
